
export default class AstarNode {
    public x:number;    //列
    public y:number;    //行
    public f:number;    //代价 f = g+h
    public g:number;    //起点到当前点代价
    public h:number;    //当前点到终点估计代价
    public walkable:boolean = false;
    public parentNode:AstarNode;
    // public bstNode:BHeapNode;
    public costMultiplier:number = 1.0;
    private _mapX:number;
    private _mapY:number;
    private _tempPoint:cc.Vec2;
    public isInCloseList:boolean;
    public isInOpenList:boolean;

    public constructor() {
        
    }

    public setXY(x:number , y:number){
        this.x = x;
        this.y = y;
    }

    public get mapX(){
        return this._mapX;
    }

    public set mapX(x:number){
        this._mapX = x;
    }

    public get mapY(){
        return this._mapY;
    }

    public set mapY(y:number){
        this._mapY = y;
    }

    public get mapPos():cc.Vec2{
        if(!this._tempPoint){
            this._tempPoint = new cc.Vec2();
        }
        this._tempPoint.x = this._mapX;
        this._tempPoint.y = this._mapY;
        return this._tempPoint;
    }
}